import kotlinx.serialization.json.Json
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import java.time.Duration

fun main() {

    val okHttpClient = OkHttpClient.Builder().connectTimeout(Duration.ofSeconds(10)).build()

    val request = Request.Builder()
        .url("http://www.httpbin.org/post")
        .post("10086".toRequestBody("application/json".toMediaType())).build()

    val responseBody = okHttpClient.newCall(request).execute().body?.string()

    println("响应的参数 $responseBody")

    // 这里将json转成JsonObject对象，但是不知道咋处理
    val model = responseBody?.let { Json.parseToJsonElement(it) }

    model.let { "data" }


    val a: String = "1"

    if (a.equals(1)) {
        println("equals : true")
    }
//    else if (a == 2) {
//
//    }

}